import Main from '@/views/Main.vue';
import util from '@/libs/util.js';

//title properties are localization keys.

export const loginRouter = {
    path: '/login',
    name: 'login',
    meta: {
        title: 'LogIn'
    },
    component: () => import('@/views/login.vue')
};

export const page404 = {
    path: '/*',
    name: 'error-404',
    meta: {
        title: '404 - Page does not exist'
    },
    component: () => import('@/views/error-page/404.vue')
};

export const page403 = {
    path: '/403',
    meta: {
        title: '403 - You are not authorized'
    },
    name: 'error-403',
    component: () => import('@//views/error-page/403.vue')
};

export const page500 = {
    path: '/500',
    meta: {
        title: '500 - Server error'
    },
    name: 'error-500',
    component: () => import('@/views/error-page/500.vue')
};
export const locking = {
    path: '/locking',
    name: 'locking',
    component: () => import('@/views/main-components/lockscreen/components/locking-page.vue')
};

// A route which is not displayed in the left menu
export const otherRouter = {
    path: '/',
    name: 'otherRouter',
    redirect: '/home',
    component: Main,
    children: [
        { path: 'home', title: '首页', name: 'home_index', component: () => import('@/views/home/home.vue') }
    ]
};

// Left menu items
export const appRouter = [
    //消息路由
    {
        path: '/message',
        icon: 'chatbubble-working',
        title: '消息',
        name: 'message',
        redirect: '/message/systemmessages',
        component: Main,
        children: [
            { path: 'systemmessages', title: '系统消息', name:'systemmessages',component:()=>import('@/views/message/systemmessages.vue')},
            { path: 'taskmessage', title: '任务消息', name:'taskmessage',component:()=>import('@/views/message/taskmessage.vue')},
            { path: 'personalmessage', title: '个人消息', name:'personalmessage',component:()=>import('@/views/message/personalmessage.vue')},
        ]
    },
    //项目路由
    {
        path: '/project',
        icon: 'ios-folder',
        title: '项目',
        name: 'project',
        redirect: '/project/projectmanagement',
        component: Main,
        children: [
            { path: 'projectmanagement', title: '项目管理', name:'projectmanagement',component:()=>import('@/views/project/projectmanagement.vue')},
            { path: 'projectprogress', title: '项目进度', name:'projectprogress',component:()=>import('@/views/project/projectprogress.vue')},
        ]
    },
    //任务路由
    {
        path: '/task',
        icon: 'ios-paper',
        title: '任务',
        name: 'task',
        redirect: '/task/taskmanagement',
        component: Main,
        children: [
            { path: 'taskmanagement', title: '我的任务', name:'taskmanagement',component:()=>import('@/views/task/taskmanagement.vue')},
            { path: 'othertasks', title: '其他任务', name:'othertasks',component:()=>import('@/views/task/othertasks.vue')},
            // { path: 'roleManagementa', title: 'RoleManagement', name:'roleManagementa',component:()=>import('@/views/admin/roleManagement/roleManagement.vue')}
        ]
    }
    // {
    //     path: '/taskmanagement',
    //     icon: 'ios-people',
    //     title: '任务管理',
    //     // name: 'administration',
    //     name: 'taskmanagement ',
    //     redirect: '/taskmanagement/systemmessagess',
    //     component: Main,
    //     children: [
    //         { path: 'systemmessagess', title: 'Tenants', name: 'systemmessagess',permission:'Pages.Tenants', component: () => import('@/views/admin/systemmessages/systemmessages.vue') },
    //         { path: 'usersa', title: 'Users', name: 'usersa',permission:'Pages.Users', component: () => import('@/views/admin/users/users.vue') },
    //         { path: 'rolesa', title: 'Roles', name: 'rolesa',permission:'Pages.Roles', component: () => import('@/views/admin/roles/roles.vue') },
    //         { path: 'abouta', title: 'About', name:'abouta',component:()=>import('@/views/admin/about/about.vue')},
    //         { path: 'texta', title: 'Text', name:'texta',component:()=>import('@/views/admin/text/text.vue')},
    //         { path: 'characterCreationa', title: 'CharacterCreation', name:'characterCreationa',component:()=>import('@/views/admin/CharacterCreation/CharacterCreation.vue')},
    //         { path: 'roleManagementa', title: 'RoleManagement', name:'roleManagementa',component:()=>import('@/views/admin/roleManagement/roleManagement.vue')}
    //     ]
    // },
];

// All the routes defined above should be written in the routers below
export const routers = [
    loginRouter,
    otherRouter,
    locking,
    ...appRouter,
    page500,
    page403,
    page404
];
